#ifndef _YMESSAGELIST_H_
#define _YMESSAGELIST_H_
#include <mutex>

using namespace std;

class YMessageListInterface {
public:
	virtual void ProcessMessage() = 0;
	virtual void SendMessage(uint8_t* data, const size_t len) = 0;
};

class YMessageList
{
public:
	YMessageList();
	~YMessageList();
	
	int Init();
	int AddData(uint8_t* data, int len);
	int GetData(uint8_t* data, int len);
	int GetNextLength();
	int Release();
	int GetCount();
	
	bool IsEmpty();
private:
	class YMessage
	{
	public:
		YMessage* pNext;
		YMessage* pFront;
		void*	  data;
		int 	  len;
	};
		
private:
	int m_nCount;
	YMessage* m_pHead;
	YMessage* m_pTail;
	std::mutex m_mutex;
};

#endif